﻿using log4net;
using log4net.Appender;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4net.config", Watch = true)]
namespace AutoAccepter
{
    class LogHelper
    {
        public static void SetPath(string path)
        {
            var repository = LogManager.GetRepository();
            var appenders = repository.GetAppenders();
            var targetApder = appenders.First(p => p.Name == "RollingLogFileAppender") as RollingFileAppender;
            targetApder.File = "log/" + path + "/log.txt";
            targetApder.ActivateOptions();
        }
        public static void WriteLog(Type t, string msg)
        {
            log4net.ILog log = log4net.LogManager.GetLogger(t);
            log.Info(msg);
        }
    }
}
